package com.hframe.filter;

import org.apache.log4j.Logger;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;


public class Debug implements Filter {
	static Logger log = Logger.getLogger(Debug.class);

	public Debug() {
	}

	@Override
	public void destroy() {
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		long time = System.currentTimeMillis();
		chain.doFilter(request, response);

		time = System.currentTimeMillis() - time;
		log.debug( "____用时\t" + time + "\t\t" + req.getRequestURI());
	}

	@Override
	public void init(FilterConfig fConfig) throws ServletException {

	}
  
}
